local hooks = require "ibl.hooks"
local custom_colors = require "custom.colors"

local highlight = {
	"RainbowRed",
	"RainbowYellow",
	"RainbowBlue",
	"RainbowOrange",
	"RainbowGreen",
	"RainbowViolet",
	"RainbowCyan",
}

-- create the highlight groups in the highlight setup hook,
-- so the are reset every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
	vim.api.nvim_set_hl(0, "RainbowRed", { fg = custom_colors.IndentRed_fg })
	vim.api.nvim_set_hl(0, "RainbowYellow", { fg = custom_colors.IndentYellow_fg })
	vim.api.nvim_set_hl(0, "RainbowBlue", { fg = custom_colors.IndentBlue_fg })
	vim.api.nvim_set_hl(0, "RainbowOrange", { fg = custom_colors.IndentOrange_fg })
	vim.api.nvim_set_hl(0, "RainbowGreen", { fg = custom_colors.IndentGreen_fg })
	vim.api.nvim_set_hl(0, "RainbowViolet", { fg = custom_colors.IndentViolet_fg })
	vim.api.nvim_set_hl(0, "RainbowCyan", { fg = custom_colors.IndentCyan_fg })
end)

require("ibl").setup { indent = { highlight = highlight } }
